home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 May / macformat-024.iso / Demos / DTP / HomePublisher Demo / AHP Pouch / AutoCreate / Business ID / _SetStyle / _SetStyle
Encoding:
Text File  |  1993-09-17  |  10.9 KB  |  488 lines  |  [SGPA/SCPG]

  1. on Corporate
  2. Global theAddressData, vHelvetica
  3. Global DocumentKind
  4.  
  5. if DocumentKind ≠ "business card" then
  6. set itemdel to numtochar(1)
  7. put 1 into linecount
  8. repeat with x = 1 to 12--2 to 9
  9. get item x of theAddressData
  10. if it ≠ empty then
  11. put it into line linecount of TheText
  12. add 1 to linecount
  13. end if
  14. end repeat
  15. set itemdel to ","
  16.  
  17. put TheText into story "Address"
  18. select all text in story "address"
  19. set StyleRecomposition to false
  20. set textfont to vHelvetica
  21. set textsize to 10
  22. set RulerJustification to left
  23. set StyleRecomposition to true
  24. copyfit
  25. else -- make some cards
  26.  
  27. -- build address block
  28. put empty into TheText
  29. set itemdel to numtochar(1)
  30. put 1 into linecount
  31. repeat with x = 2 to 12 --2 to 7
  32. if x ≠ 10 then
  33. get item x of theAddressData
  34. if it ≠ empty then
  35. put it into line linecount of TheText
  36. add 1 to linecount
  37. end if
  38. end if
  39. end repeat
  40. put TheText into story "address 1"
  41.  
  42. select all text in story "address 1"
  43. set StyleRecomposition to false
  44. set textfont to vHelvetica
  45. set textface to plain
  46. set textsize to 12
  47. set RulerJustification to left
  48. set StyleRecomposition to true
  49. copyfit
  50.  
  51.  
  52. -- build name/position block
  53. put empty into TheText
  54. get item 1 of theAddressData
  55. if it ≠ empty then
  56. put it into story "person 1"
  57. select all text in story "person 1"
  58. set textfont to vHelvetica
  59. set textface to plain
  60. set textface to uppercase
  61. end if
  62. get item 10 of theAddressData
  63. if it ≠ empty then
  64. put cr&it after story "person 1"
  65. select text last line of story "person 1"
  66. set textfont to vHelvetica
  67. set textface to plain
  68. end if
  69. select all text in story "person 1"
  70. set FlexibleCharSize to false
  71. set StyleRecomposition to false
  72. set textsize to 12
  73. set RulerJustification to right
  74. set StyleRecomposition to true
  75. copyfit 
  76.  
  77. select all objects
  78. put measurements into oldMeasurements
  79. set measurements to millimeters
  80. replicate custom 1 98 100 0 100
  81. select all objects
  82. replicate custom 3 0 100 58 100
  83. select empty
  84. set measurements to oldMeasurements
  85. set itemdel to ","
  86. answer "Select " & quote & "Larger Print Area" & quote & " from Options…" with "OK"
  87. domenu "Page Setup…"
  88. end if
  89. end Corporate
  90.  
  91.  
  92. on Elegant
  93. Global theAddressData, vPalatino,vHelvetica
  94. Global DocumentKind
  95.  
  96.  
  97. set linedel to numtochar(1)
  98. set itemdel to numtochar(1) -- have to do this so commas in addresses aren't ignored
  99. set findString to numtoChar(1)
  100. set replaceString to ", "
  101.  
  102. get line 2 of theAddressData
  103. if it  ≠ empty then put it into story "Company Name"
  104.  
  105. -- Set company name style
  106. Select all text in story "Company Name"
  107. set StyleRecomposition to false
  108. set textfont to vPalatino
  109. set textface to plain
  110. Set TextSize to 18
  111. set RulerJustification to Center
  112. set TextFace to SmallCaps
  113. set StyleRecomposition to true
  114. if not storyfits(story "Company Name") then 
  115. set textface to plain
  116. copyfit
  117. end if
  118.  
  119. if DocumentKind ≠ "business card" then
  120. put 1 into itemcount
  121. repeat with x = 1 to 12--3 to 9
  122. if x <> 2 then -- skip company name in this block
  123. get line x of theAddressData
  124. if it ≠ empty then
  125. put it into item itemcount of TheText
  126. add 1 to itemcount
  127. end if
  128. end if
  129. end repeat
  130. set linedel to cr
  131.  
  132. put TheText into story "Address"
  133. select all text in story "Address"
  134. put replaceall(story "Address") into replaceCount
  135. select all text in story "Address"
  136. set StyleRecomposition to false
  137. set textfont to vPalatino
  138. set textface to plain
  139. set textsize to 12
  140. set RulerJustification to center
  141. set textface to SmallCaps
  142. set StyleRecomposition to true
  143. if not storyfits(story "Address") then 
  144. set textface to plain
  145. copyfit
  146. end if
  147. else -- time to make some cards
  148.  
  149. -- build address block
  150.  
  151. put empty into TheText
  152. set linedel to numtochar(1)
  153. put 1 into itemcount
  154. repeat with x = 3 to 6 --2 to 6
  155. get line x of theAddressData
  156. if it ≠ empty then
  157. put it into item itemcount of TheText
  158. add 1 to itemcount
  159. end if
  160. end repeat
  161. put TheText into story "address 1"
  162. put replaceall(story "address 1") into replaceCount
  163.  
  164. -- build phone block
  165. put empty into TheText
  166. put 1 into itemcount
  167. repeat with x =  7 to 12 --7 to 9
  168. if x ≠ 10 then
  169. get line x of theAddressData
  170. if it ≠ empty then
  171. put it into item itemcount of TheText
  172. add 1 to itemcount
  173. end if
  174. end if
  175. end repeat
  176. if theText ≠ empty then put cr&theText after story "address 1"
  177. set linedel to cr
  178.  
  179. put replaceall(story "address 1") into replaceCount
  180. select all text in story "address 1"
  181. set StyleRecomposition to false
  182. set textfont to vPalatino
  183. set textface to plain
  184. set textsize to 12
  185. set RulerJustification to center
  186. set textface to SmallCaps
  187. set StyleRecomposition to true
  188. if not storyfits(story "address 1") then 
  189. set textface to plain
  190. copyfit
  191. end if
  192.  
  193.  
  194. -- build name/position block
  195. put empty into TheText
  196. set itemdel to numtochar(1)
  197. get item 1 of theAddressData
  198. if it ≠ empty then put it into TheText
  199. get item 10 of theAddressData
  200. if it ≠ empty then put cr&it after TheText
  201. put theText into story "person 1"
  202. put replaceall(story "person 1") into replaceCount
  203. select all text in story "person 1"
  204. set styleRecomposition to false
  205. set textfont to vHelvetica
  206. set textsize to 10
  207. set textface to plain
  208. set textface to bold
  209. set styleRecomposition to true
  210. if item 10 of theAddressData ≠ empty then 
  211. select text last line of story "person 1"
  212. set textfont to vHelvetica
  213. set textface to plain
  214. set textface to italic
  215. set textsize to 8
  216. end if
  217. select all text in story "person 1"
  218. set FlexibleCharSize to false
  219. set RulerJustification to center
  220. if not storyfits(story "person 1") then 
  221. copyfit
  222. end if
  223.  
  224. select all objects
  225. put measurements into oldMeasurements
  226. set measurements to millimeters
  227. replicate custom 1 96.5 100 0 100
  228. select all objects
  229. replicate custom 3 0 100 59 100
  230. set measurements to oldMeasurements
  231. select empty
  232.  
  233. set itemdel to ","
  234. end if
  235. answer "Select " & quote & "Larger Print Area" & quote & " from Options…" with "OK"
  236. domenu "Page Setup…"
  237. end Elegant
  238.  
  239.  
  240. on Modern
  241. Global theAddressData, vHelvetica
  242. Global DocumentKind
  243.  
  244. if DocumentKind ≠ "Business Card" then
  245. set itemdel to numtochar(1)
  246. put 1 into linecount
  247. repeat with x = 1 to 12
  248. get item x of theAddressData
  249. if it ≠ empty then
  250. put it into line linecount of TheText
  251. add 1 to linecount
  252. end if
  253. end repeat
  254. set itemdel to ","
  255. put TheText into story "Address"
  256. select all text in story "address"
  257. set StyleRecomposition to false
  258. set textfont to vHelvetica
  259. set textface to plain
  260. set textsize to 10
  261. set RulerJustification to right
  262. set FlexibleCharSize to false
  263. set StyleRecomposition to true
  264. copyfit
  265. else -- time to make some cards
  266.  
  267. put empty into TheText
  268. set itemdel to numtochar(1)
  269. put 1 into linecount
  270. repeat with x =  2 to 6 --2 to 6
  271. get item x of theAddressData
  272. if it ≠ empty then
  273. put it into line linecount of TheText
  274. add 1 to linecount
  275. end if
  276. end repeat
  277. put TheText into story "address 1"
  278. select all text in story "address 1"
  279. set StyleRecomposition to false
  280. set textfont to vHelvetica
  281. set textface to plain
  282. set textsize to 10
  283. set RulerJustification to right
  284. set StyleRecomposition to true
  285. copyfit
  286.  
  287. -- build name/position block
  288. put empty into TheText
  289. get item 1 of theAddressData
  290. if it ≠ empty then
  291. put it into story "person 1"
  292. select all text in story "person 1"
  293. set textfont to vHelvetica
  294. set textface to plain
  295. set textface to bold
  296. end if
  297. get item 10 of theAddressData
  298. if it ≠ empty then
  299. put cr&it after story "person 1"
  300. select text last line of story "person 1"
  301. set textfont to vHelvetica
  302. set textface to plain
  303. set textface to italic
  304. end if
  305.  
  306. select all text in story "person 1"
  307. set FlexibleCharSize to false
  308. copyfit 
  309.  
  310. -- build phone block
  311. put empty into theText
  312. put 1 into linecount
  313. repeat with x =  7 to 12 --7 to 12
  314. if x ≠ 10 then
  315. get item x of theAddressData
  316. if it ≠ empty then
  317. put it into line linecount of TheText
  318. add 1 to linecount
  319. end if
  320. end if
  321. end repeat
  322. put TheText into story "phonefaxtelex 1"
  323. select all text in story "phonefaxtelex 1"
  324. set StyleRecomposition to false
  325. set textfont to vHelvetica
  326. set textface to plain
  327. set textsize to 10
  328. set RulerJustification to right
  329. set StyleRecomposition to true
  330. set FlexibleCharSize to false
  331. copyfit 
  332. set itemdel to ","
  333.  
  334. select all objects
  335. put measurements into oldMeasurements
  336. set measurements to millimeters
  337. replicate custom 1 95 100 0 100
  338. select all objects
  339. replicate custom 3 0 100 58 100
  340. set measurements to oldMeasurements
  341. select empty
  342. answer "Select " & quote & "Larger Print Area" & quote & " from Options…" with "OK"
  343. domenu "Page Setup…"
  344. end if
  345. end Modern
  346.  
  347. on NewWave
  348. Global theAddressData, vHelvetica
  349. Global DocumentKind
  350.  
  351. if DocumentKind ≠ "Business Card" then
  352. set itemdel to numtochar(1)
  353. put 1 into linecount
  354. repeat with x =  1 to 12 --2 to 8
  355. get item x of theAddressData
  356. if it ≠ empty then
  357. put it into line linecount of TheText
  358. add 1 to linecount
  359. end if
  360. end repeat
  361. set itemdel to ","
  362. put TheText into story "Address"
  363. select all text in story "address"
  364. set StyleRecomposition to false
  365. set textfont to vHelvetica
  366. set textface to plain
  367. set textface to italic
  368. set textsize to 10
  369. set RulerJustification to left
  370. set FlexibleCharSize to false
  371. set StyleRecomposition to true
  372. copyfit
  373.  
  374. else
  375.  
  376. -- start with a clean slate
  377. select empty
  378. --    select objects where the number of this object > 11
  379. --    clear
  380.  
  381. -- build the text
  382. set itemdel to numtochar(1)
  383. put 1 into linecount
  384. repeat with x =  2 to 12 --2 to 12
  385. if x ≠ 10 then
  386. get item x of theAddressData
  387. if it ≠ empty then
  388. put it into line linecount of TheText
  389. add 1 to linecount
  390. end if
  391. end if
  392. end repeat
  393.  
  394. add 1 to linecount
  395.  
  396. get item 1 of theAddressData
  397. if it ≠ empty then
  398. put it into line linecount of TheText
  399. put linecount into nameline
  400. add 1 to linecount
  401. end if
  402. get item 10 of theAddressData
  403. if it ≠ empty then put it into line linecount of TheText
  404.  
  405. -- Do cards' Text
  406.  
  407. put TheText into story "Address 1"
  408. select all text in story "Address 1"
  409.  
  410. set StyleRecomposition to false
  411. set textfont to vHelvetica
  412. set textface to plain
  413. set textface to italic
  414. set textsize to 10
  415. set RulerJustification to left
  416. set FlexibleCharSize to false
  417. if exists(nameline) then
  418. select text line nameline of story "Address 1"
  419. set textface to bold
  420. end if
  421. set StyleRecomposition to true
  422. copyfit
  423.  
  424. set itemdel to ","
  425.  
  426. select all objects
  427. replicate custom 1 276 100 0 100
  428. select all objects
  429. replicate custom 3 0 100 164 100
  430. select empty
  431. answer "Select " & quote & "Larger Print Area" & quote & " from Options…" with "OK"
  432. domenu "Page Setup…"
  433. end if
  434.  
  435. end NewWave
  436.  
  437. on Personal 
  438. Global theAddressData, vHelvetica
  439.  
  440.  
  441. set itemdel to numtochar(1)
  442. put 1 into linecount
  443. repeat with x = 1 to 12
  444. get item x of theAddressData
  445. if it ≠ empty then
  446. put it into line linecount of TheText
  447. add 1 to linecount
  448. end if
  449. end repeat
  450. set itemdel to ","
  451.  
  452. put TheText into story "Address"
  453. select all text in story "address"
  454. set StyleRecomposition to false
  455. set textfont to vHelvetica
  456. set textsize to 10
  457. set RulerJustification to left
  458. set StyleRecomposition to true
  459.  
  460.  
  461. end Personal
  462.  
  463.  
  464. on Traditional 
  465. Global theAddressData, vHelvetica
  466.  
  467. set itemdel to numtochar(1)
  468. put 1 into linecount
  469. repeat with x =  1 to 12 --1 to 9
  470. get item x of theAddressData
  471. if it ≠ empty then
  472. put it into line linecount of TheText
  473. add 1 to linecount
  474. end if
  475. end repeat
  476. set itemdel to ","
  477.  
  478. put TheText into story "Address"
  479. select all text in story "address"
  480. set StyleRecomposition to false
  481. set textfont to vHelvetica
  482. set textsize to 10
  483. set RulerJustification to left
  484. set StyleRecomposition to true
  485. copyfit
  486.  
  487. end Traditional
  488.         ≠<BÏ